home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wonky Flux Batch 2019 02
/
Wonky_Flux_Batch_2019-02.zip
/
Wonky Flux Batch 2019-02
/
089 - Misc Stuff - PD.dsk
/
MULTIPLY DEMO.S
< prev
next >
Wrap
Text File
|
2019-02-17
|
3KB
|
158 lines
AST 32
*
* >>> MULTIPLY DEMO <<<
* WRITTEN BY
*
* DAVID B GARSON
*
AST 32
TEMP EQU $03
SIGN EQU $2F
ACL EQU $50
ACH EQU $51
XTNDL EQU $52
XTNDH EQU $53
AUXL EQU $54
AUXH EQU $55
M1 EQU $3E
M2 EQU $3C
MUL EQU $303
YVEC EQU $3F8
HOME EQU $FC58
CAR EQU $FD8E
PRTB EQU $FDDA
COUT EQU $FDED
MON EQU $FF69
ORG $803
* SET CTRL Y VECTOR
LDA #$4C
STA YVEC
LDA #<STAR
STA YVEC+1
LDA #>STAR
STA YVEC+2
JMP INTRO
* THE PURPOSE OF THIS DEMO IS
* TO SHOW THE USE OF THE
* MULTIPLY ROUTINE IN THE
* APPLE'S MONITOR
* INPUTTING DATA TO MULTIPLY
* IS DONE THROUGH THE USE OF
* CONTROL "Y" AND ZERO PAGE
* LOCATIONS $3C-$3F. THESE
* LOCATIONS WILL CONTAIN THE
* LAST TWO NUMBERS TYPED IN.
* TO ACTUALLY USE THE ROUTINE,
* JUST TYPE XXXX.YYYY (CTRL Y),
* WHERE XXXX AND YYYY EQUAL ANY
* VALID HEX NUMBER FROM 0-FFFF.
* $50,51 ARE LOCNS OF FIRST NBR
* $54,55 ARE LOCNS OF SECOND NBR
* REMEMBER TO SET UP LOW ORDER
* THEN HIGH ORDER IN EACH CASE,
* THEN CALL $FB63 (OLD MONITOR).
* LOCNS $50 TO 53 WILL CONTAIN
* RESULTS, LOW TO HIGH.
* IMPORTANT! REMEMBER TO ZERO
* LOCATIONS $52,53 BEFORE
* CALLING "MUL".
* HERE COMES THE PROGRAM
STAR LDA #$00 ;THESE LOCNS MUST
STA XTNDL ;ZERO BEFORE
STA XTNDH ;CALLING "MUL"
LDA M1
STA AUXL
LDA M1+1
STA AUXH
LDA M2
STA ACL
LDA M2+1
STA ACH
* THE VARIABLES HAVE NOW BEEN MOVED TO THEIR
* PROPER POSITION FOR USE BY THE MULTIPLY ROUTINE
JSR MUL ;THIS IS THE
* ROUTINE THAT DOES ALL THE WORK
* NOW DISPLAY THE RESULTS
LDX #$03
DISP LDA ACL,X
JSR PRTB
DEX
BPL DISP
JSR CAR
JMP MON
* MESSAGE OUTPUT BY ANDY HERTZFELD
MSGOUT PLA
STA TEMP
PLA
STA TEMP+1
LDY #0
LOOP INC TEMP
BNE SKIPADD
INC TEMP+1
SKIPADD LDA (TEMP),Y
BEQ MSGRTS
JSR COUT
JMP LOOP
MSGRTS LDA TEMP+1
PHA
LDA TEMP
PHA
RTS
INTRO JSR HOME
JSR MSGOUT
HEX 8D
ASC "HOW TO USE THE MULTIPLY ROUTINES ON"
HEX 8D
ASC "THIS DISKETTE: THE MULTIPLY/DIVIDE"
HEX 8D
ASC "ROUTINES MUST BE IN MEMORY."
HEX 8D8D
ASC "ENTER THE FIRST NUMBER, A PERIOD, THE"
HEX 8D
ASC "SECOND NUMBER, A CTRL Y."
HEX 8D8D
ASC "DATA SHOULD BE ENTERED IN THE FORM"
HEX 8D
ASC "XXXX.YYYY (CTRL Y), WHERE XXXX AND"
HEX 8D
ASC "YYYY ARE HEX NUMBERS."
HEX 8D8D
ASC "RESULTS ARE IN 50.53 AND WILL BE PRINTED"
ASC "BY THIS DEMO PROGRAM."
HEX 8D00
JMP MON